fix: function type generation for zero arg and scalar computed fields#1035
Open
7ttp wants to merge 2 commits intosupabase:masterfrom
Open
fix: function type generation for zero arg and scalar computed fields#10357ttp wants to merge 2 commits intosupabase:masterfrom
7ttp wants to merge 2 commits intosupabase:masterfrom
Conversation
… computed field false positive
avallete
reviewed
Feb 2, 2026
| const tablesNamesByTableId: Record<number, string> = {} | ||
| const relationTypeByIds = new Map<number, (typeof types)[number]>() | ||
| // group types by id for quicker lookup | ||
| const typesById = new Map<number, (typeof types)[number]>() |
Member
There was a problem hiding this comment.
Suggested change
| const typesById = new Map<number, (typeof types)[number]>() | |
| // group types by id for quicker lookup | |
| const typesById = new Map<number, (typeof types)[number]>() |
Comment on lines
+201
to
+203
| !getTableNameFromRelationId(func.return_type_relation_id, func.return_type_id)) || | ||
| // OR if the function takes a table/view row (computed field) | ||
| tableAndViewNames.has(func.argument_types))) |
Member
There was a problem hiding this comment.
I think this should already be covered by: https://github.com/supabase/postgres-meta/pull/1035/changes#diff-c903ec71df16a8ae5f665c19c21b273f74c2f8eb02f5e8a3552ebe69d18be18fR196-R198 🤔
| return fns | ||
| .map(({ fn, inArgs }) => { | ||
| let argsType = 'never' | ||
| let argsType = 'Record<PropertyKey, never>' |
Member
There was a problem hiding this comment.
This needs to be tested with the inference within https://github.com/supabase/supabase-js/tree/master/packages/core/postgrest-js as I expect this might break a few things.
I remember having to use never specifically here to be able to detect the difference between actual functions with args, and functions with no args. Using a Record<string, never> in my memory didn't allowed that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problems
never extends Tis always true)name_translated(products)are not added to Row typesSolution
Record<PropertyKey, never>instead ofneverfor zero-arg function ArgsRelated
Args: neverand names matching table columns cause columns to be omitted fromselect('*')return types #1039